import http, { RequestParams } from '@/utils/request';
import http_imou from '@/utils/requestImou';

class EquipRequest {
  /**
   * 根据呼叫器ID获得场所
   * @param params
   * @constructor
   */
  public static GetLocaleIdByBeeper(params: RequestParams) {
    return http.get<Number>('wx/v1/locale/getLocaleId', params);
  }

  /**
   * 获得场所列表
   * @param params
   * @constructor
   */
  public static LocaleList(params: RequestParams) {
    return http.get<ILocaleFewInfoRes[]>('wx/v1/locale/listIdName', params);
  }

  public static GetLocaleDetail(params: RequestParams) {
    return http.get<ILocaleDetailRes>('wx/v1/locale', params);
  }

  /**
   * 开通场所邻里互助
   * @param params
   * @constructor
   */
  public static SetHelpFlag(params: RequestParams) {
    return http.put<boolean>('wx/v1/locale/setHelpFlag', params);
  }

  /**
   * 解绑场所
   * @param params
   * @constructor
   */
  public static UnbindingLocale(params: RequestParams) {
    return http.put<boolean>('wx/v1/locale/unbindLocale', params);
  }

  /**
   * 修改场所名称
   * @param params
   * @constructor
   */
  public static UpdateLocaleName(params: RequestParams) {
    return http.put<boolean>('wx/v1/locale/setNickName', params);
  }

  /**
   * 获取场所紧急联系人
   * @param params
   * @constructor
   */
  public static GetLocaleContact(params: RequestParams) {
    return http.get<ILocaleContactRes>('wx/v1/localeContact', params);
  }

  /**
   * 设置场所紧急联系人
   * @param params
   * @constructor
   */
  public static SaveLocaleContact(params: RequestParams) {
    return http.post<boolean>('wx/v1/localeContact/setLocaleContact', params);
  }

  /**
   * 获取场所下的设备列表
   * @param params
   * @constructor
   */
  public static LocaleEquipList(params: RequestParams) {
    return http.get<IEquipRes[]>('wx/v1/equip/listEquipByCustomer', params);
  }

  /**
   * 获得绑定呼叫器的信息
   * @param params
   * @constructor
   */
  public static ObtBindCallerInfo(params: RequestParams) {
    return http.post<IObtBindCallerInfoRes>('wx/v1/customer/getEquipInfo', params);
  }

  /**
   * 绑定呼叫器或设备
   * @param params
   * @constructor
   */
  public static BindCallerDevice(params: RequestParams) {
    return http.post('wx/v1/customer/equipBinding', params);
  }

  /**
   * 获取场所下的用户列表(除去自己)
   * @param params
   * @constructor
   */
  public static ListCustomerByLocale(params: RequestParams) {
    return http.get<ILocaleCustomerRes[]>('wx/v1/customer/listCustomerByLocaleId', params);
  }

  /**
   * 修改场所用户（授权、解绑、设置主用户、设置关系）
   * @param params
   * @constructor
   */
  public static UpdateLocaleCustomer(params: RequestParams) {
    return http.put<boolean>('wx/v1/customer/customerOperation', params);
  }

  /**
   * 获取设备详情
   * @param params
   * @constructor
   */
  public static GetEquipDetail(params: RequestParams) {
    return http.get<IEquipDetailRes>('wx/v1/equip/getEquipMoreInfo', params);
  }
  /**
   * 解绑设备
   * @param params
   * @constructor
   */
  public static UnbindingEquip(params: RequestParams) {
    return http.put<boolean>('wx/v1/equip/unbinding', params);
  }

  /**
   * 解除设备报警
   * @param params
   * @constructor
   */
  public static CancelEquipAlarm(params: RequestParams) {
    return http.put<IEquipDetailRes>('wx/v1/equip/equipAllClear', params);
  }

  /**
   * 设备立即定位
   * @param params
   * @constructor
   */
  public static EquipStartSite(params: RequestParams) {
    return http.get<boolean>('wx/v1/equip/startSite', params);
  }

  /**
   * 修改燃气阀门状态（0开1关）
   * @param params
   * @constructor
   */
  public static UpdateGasValveState(params: RequestParams) {
    return http.get<boolean>('wx/v1/gas/updateValveState', params);
  }

  /**
   * 获取设备定位信息
   * @param params
   * @constructor
   */
  public static GetSiteNow(params: RequestParams) {
    return http.get<IGetSiteNow>('wx/v1/equip/getSiteNow', params);
  }

  /**
   * 设置设备信息 type 1：修改昵称 2：修改安装区域 3：修改报警有效时间 4.修改设备使用人
   * @param params
   * @constructor
   */
  public static SetEquipInfo(params: RequestParams) {
    return http.put<boolean>('wx/v1/equip/setEquipInfo', params);
  }

  /**
   * 获取检测信息
   * @param params
   * @constructor
   */
  public static GetExamineInfo(params: RequestParams) {
    return http.get<IGetExamineInfo>('wx/v1/equipLog/health/today', params);
  }

  /**
   * 开始检测
   * @param params
   * @constructor
   */
  public static StartExamine(params: RequestParams) {
    return http.get<null>('wx/v1/watch/checkSafetyNow', params);
  }

  /**
   * 获取定时检测数据
   * @param params
   * @constructor
   */
  public static GetCheckRate(params: RequestParams) {
    return http.get<string>('wx/v1/watch/getCheckRate', params);
  }

  //设置定位检测时间
  public static SetCheckRate(params: RequestParams) {
    return http.get<null>('wx/v1/watch/setSafetyParam', params);
  }

  //开始定位
  public static StartSite(params: RequestParams) {
    return http.get<null>('wx/v1/watch/startSite', params);
  }

  //设置定位频率
  public static SetSiteRate(params: RequestParams) {
    return http.get<null>('wx/v1/watch/setSiteRate', params);
  }

  /**
   * 获取呼叫器详情
   * @param params
   * @constructor
   */
  public static GetBeeperDetail(params: RequestParams) {
    return http.get<IBeeperDetailRes>('wx/v1/beeper', params);
  }

  /**
   * 设置呼叫器地址中的联系人备用电话
   * @param params
   * @constructor
   */
  public static SetBeeperPhoneTwo(params: RequestParams) {
    return http.put<boolean>('wx/v1/beeper/setBeeperPhoneTwo', params);
  }

  /**
   * 给硬件呼叫器下发指令 type: 24: 设置语音识别开关(0关 1开) 25: 设置低电提醒开关(0关 1开)
   * @param params
   * @constructor
   */
  public static SendCmdToBeeper(params: RequestParams) {
    return http.get<boolean>('wx/v1/beeper/sendCmd', params);
  }
  /**
   * 血糖仪、血压仪报告列表
   * @param params
   * @constructor
   */
  public static ListSugarDetection(params: RequestParams) {
    return http.get<ISugarDetectionRes[]>('wx/v1/sugar/detection/list', params);
  }

  /**
   * 查看足迹
   * @param params
   * @constructor
   */
  public static GetFootPrintList(params: RequestParams) {
    return http.get<IFootPrintList[]>('wx/v1/watch/getTrack', params);
  }

  /**
   * 获取检测报告
   * @param params
   * @constructor
   */
  public static GetExamineRecord(params: RequestParams) {
    return http.get<IListRes<IExamineInfo>>('wx/v1/equipLog/health/page', params);
  }

  /**
   * 获取报警记录
   * @param params
   * @constructor
   */
  public static GetAlarmRecord(params: RequestParams) {
    return http.get<IListRes<IAlarmRecord>>('wx/v1/equipLog/alarm/page', params);
  }

  /**
   * 设置紧急联系人
   * @param params
   * @constructor
   */
  public static SetContact(params: RequestParams) {
    return http.post<boolean>('wx/v1/equipContact/setEquipContact', params);
  }

  /**
   * 获取紧急联系人
   * @param params
   * @constructor
   */
  public static GetContact(params: RequestParams) {
    return http.get<IContact>('wx/v1/equipContact/getDataByEquipId', params);
  }

  /**
   * 获取当前场所下的绑定用户
   * @param params
   * @constructor
   */
  public static GetEquipUserInfo(params: RequestParams) {
    return http.get<IEquipUserInfo[]>('wx/v1/customer/listUserCustomer', params);
  }

  /**
   * 获取微聊好友
   * @param params
   * @constructor
   */
  public static GetChatList(params: RequestParams) {
    return http.get<IChat[]>('wx/v1/beeperChar/getChatList', params);
  }

  /**
   * 删除微聊好友
   * @param params
   * @constructor
   */
  public static DelMicroChatFriend(params: RequestParams) {
    return http.post<boolean>('wx/v1/beeperChar/deleteBeeperChat', params);
  }

  /**
   * 获取全网通呼叫器
   * @param params
   * @constructor
   */
  public static GetAssignBeeper(params: RequestParams) {
    return http.get<IAssignBeeperList[]>('wx/v1/beeperChar/getCurrencyNetworkEquip', params);
  }

  /**
   * 新增微聊好友
   * @param params
   * @constructor
   */
  public static AddMicroChatFriend(params: RequestParams) {
    return http.post<boolean>('wx/v1/beeperChar/saveBeeperChat', params);
  }

  /**
   * 修改微聊好友
   * @param params
   * @constructor
   */
  public static EditMicroChatFriend(params: RequestParams) {
    return http.post<boolean>('wx/v1/beeperChar/updateBeeperChat', params);
  }

  /**
   * 设置呼叫器通讯录联系人
   * @param params
   * @constructor
   */
  public static SetBeeperContacts(params: RequestParams) {
    return http.post<boolean>('wx/v1/equipContact/setBeeperContact', params);
  }

  /**
   * 预警设置
   * @param params
   * @constructor
   */
  public static EarlyWarningSetting(params: RequestParams) {
    return http.put<boolean>('wx/v1/infrared/setAlarmMode', params);
  }

  /**
   * 乐橙云 - 获取token
   * @param params
   * @constructor
   */
  public static ImouToken(params: RequestParams) {
    return http_imou.post<{ accessToken: string; expireTime: number }>('accessToken', params);
  }

  /**
   * 乐橙云 - 通过设备id获取设备
   * @param params
   * @constructor
   */
  public static ListDeviceDetailsByIds(params: RequestParams) {
    return http_imou.post<IListDeviceDetailsByIdsRes>('listDeviceDetailsByIds', params);
  }

  /**
   * 乐橙云 - 创建小程序临时token用于播放监控
   * @param params
   * @constructor
   */
  public static CreateWeChatMiniProgramToken(params: RequestParams) {
    return http_imou.post<{ expireTime: number; miniToken: string }>('createWeChatMiniProgramToken', params);
  }

  // createWeChatMiniProgramToken
}

export default EquipRequest;
